<% content_for :sidemenu do %>
  <div class='admin_filters'>
    <%= form_tag admin_inventory_suppliers_path, method: 'get', id: "suppliers_search" do %>
      <%= hidden_field_tag :direction, params[:direction] %>
      <%= hidden_field_tag :sort, params[:sort] %>

      <label>Name</label>
      <%= text_field_tag :name, params[:name] %>

      <label>Email</label>
      <%= text_field_tag :email, params[:email] %>

      <div style='text-align:center'>
        <%= submit_tag "Search", name: nil, class: 'button red-button alert' %>
      </div>
    <% end %>
  </div>
<% end %>

<div class="admin_title_header">
  <h3>Suppliers</h3>
  <%= link_to "New Supplier", new_admin_inventory_supplier_path, class: "button" %>
</div>

<div class="admin_suppliers">
  <table class='hover'>
    <thead>
    <tr class='odd'>
      <th class='column1_header'><%= sortable "name", "Name" %></th>
      <th><%= sortable "email" %></th>
    </tr>
    </thead>
    <% @suppliers.each do |supplier| %>
      <tr class='<%= cycle("odd", "")%>'>
        <td><%= link_to supplier.name, edit_admin_inventory_supplier_path(supplier) %></td>
        <td><%= supplier.email %></td>
      </tr>
    <% end %>
  </table>

  <%= will_paginate @suppliers %>
</div>
